package com.interview.ujiuye9;

public class Insert
{
	public static void main(String[] args)
	{
		int[] ins = {2,3,5,1,23,6,78,34};
		int[] ins2 = sort2(ins);
		for(int in: ins2){
			System.out.println(in);
		}
	}
	public static int[] sort2(int[] ins){
		for(int i=1; i<ins.length; i++){
			int temp = ins[i];//保存每次需要插入的那个数
			int j;
			for(j=i; j>0&&ins[j-1]>temp; j--){
				ins[j] = ins[j-1];
			}
			ins[j] = temp;
		}
		return ins;
	}
}
